<?php
/**
 * 在职图表
 */
apf_require_controller("Abstract");
apf_require_class("Report_Urls");
class Report_IndexController extends AbstractController {

    public function handle_request() {
        //获取权限城市+部门
        $count = $this->_get_bll_report()->check_view_auth($this->user_info['user_id']);
        if(!$count){
            $this->show_tips('ERROR_AUTH');
        }

        $data['base_data'] = $this->_get_bll_report()->get_current_on_job($this->user_info['user_id']);
        //月度时间
        $plan_num = $data['base_data']['plan_num'];

        $datalist = $this->_get_bll_report()->get_enter_report($this->user_info['user_id']);
        foreach($datalist as $y =>$val){
            $data['datalist'][$y]['pnum'] = $plan_num;
            $data['datalist'][$y]['anum'] = $val['on_job_num'];
            $data['datalist'][$y]['p'] = $val['on_p_num'];
            $data['datalist'][$y]['m'] = $val['on_m_num'];
            $data['datalist'][$y]['time'] = $val['time'];
        }
        $this->request->set_attribute('data', $data);
        return "Report_Index";
    }
    /**
     *
     * @return Bll_Report_Report
     */
    private function _get_bll_report(){
        if(!$this->_bll_report){
            apf_require_class("Bll_Report_Report");
            $this->_bll_report = new Bll_Report_Report();
        }
        return $this->_bll_report;
    }
}